package com.wandian.executor;

/**
 * @author long
 * @Create 2012-11-13 下午3:10:41
 * @QQ 108232706
 * @version 1.0
 * @description DelayAction
 */
public abstract class DelayAction extends Action
{
	protected long execTime;

	public DelayAction(ActionQueue queue, int delay)
	{
		super(queue);
		this.execTime = (System.currentTimeMillis() + delay);
	}

	public DelayAction(ActionQueue queue, long curTime, int delay) {
		super(queue);
		this.execTime = (curTime + delay);
	}

	public boolean canExec(long curTime) {
		if (curTime > this.execTime) {
			this.createTime = Long.valueOf(curTime);
			getActionQueue().enqueue(this);
			return true;
		}
		return false;
	}
}